package jackie.programQuestion;

import java.util.Scanner;

/**
 * Created by acer on 2016/3/4.
 */
public class Test {
    static int[][] a;
    static int[][] b;
    static int N;
    static int M;
    static int K;

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        while (input.hasNext()) {
            N = input.nextInt();
            M = input.nextInt();
            K = input.nextInt();
            for (int i = 0; i < K; i++) {
                int x = input.nextInt();
                int y = input.nextInt();
                a[x][y]++;
            }
            System.out.println(Max());
        }
    }


    public static int Max () {
        if(N<=3&&M<=3)return K;
        if(N<=6&&M<=3)return K;
        if(N<=3&&M<=6)return K;
        for (int i = 1; i < N-1; i++) {
            for(int j =1;j<M-1;j++){
                int sum =0;
                sum=sum+a[i][j]+a[i-1][j-1]+a[i-1][j]+a[i-1][j+1]+a[i][j-1]+a[i][j+1]+a[i+1][j-1]+
                        a[i+1][j]+a[i+1][j+1];
                b[i][j]=sum;
            }

        }
        return 0;
    }

}
